#!/usr/bin/perl
# file time_of_day_tcp2.pl
use strict;
use IO::Socket qw(:DEFAULT :crlf);

my $host = shift || 'time.nist.gov';
$/ = CRLF;      # 设置行尾分隔符

my $socket = IO::Socket::INET->new("$host:daytime") or die "Can't connect $host: $!";
#创建套接字

# chomp(my $time = $socket->getline);
my $time = $socket->getline;
print $time, "\n";